// pages/Zero/index/index.js
var common = require("../../../../public.js");
Page({
  /**
   * 页面的初始数据
   */
  data: {
    zeroData: [],
    pageNum: 1,
    distanceSort: 1,
    saleSort: 1,
    timeSort: 1,
    xpoint: '',
    ypoint: '',
    isLoading: false
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getZeroList()
  },
  getZeroList: function () {
    const that = this
    let tempJson = {
      pageNum: that.data.pageNum,
      distanceSort: that.data.distanceSort,
      saleSort: that.data.saleSort,
      timeSort: that.data.timeSort,
      xpoint: that.data.xpoint,
      ypoint: that.data.ypoint,
    }
    this.setData({
      isLoading: true
    })
    common.post('/findZeroBuyGoodsList', tempJson, function (res) {
      that.setData({
        zeroData: res.data.result_list
      })
    }, function () {
      that.setData({
        isLoading: false
      })
    })
  },
  toZeroDetail(e) {
    console.log(e)
    let {
      item
    } = e.currentTarget.dataset
    wx.navigateTo({
      url: '/packageC/pages/Zero/Des/index?id=' + item.id + "&name=" + item.goodsTitle,
    })
  }
})